#include <stdio.h>
#include <conio.h>
#include <graphics.h>
int main()
{
	float PI = 3.1415926;
	initgraph(1200,800);//打开一个窗口
	setbkcolor(RGB(128,128,128));
	cleardevice();//画布白色
	int centerX = 300;
	int centerY = 300;
	int radius = 200;
	float offset;
	float totaloffset = 0;
	//setlinecolor(RED);
	//circle(centerX,centerY,radius);//画个空心的圆
	while(1)
	{
		for(centerX = 200; centerX < 1200; centerX+=400)
		{
			for(centerY = 200; centerY < 1200; centerY+=400)
			{
				for(radius = 200; radius > 0; radius-=50)
				{
					int left = centerX - radius;
					int right = centerX + radius;
					int top = centerY + radius;
					int bottom =centerY - radius;
					int i;
					float h = rand()%180;
					COLORREF color1 = HSVtoRGB(h,0.9,0.8);
					COLORREF color2 = HSVtoRGB(h+180,0.9,0.8);
					for(i = 0; i < 20; i++ )
					{
						offset = i*PI/10+totaloffset;
						setfillcolor(color1);//青色
						solidpie(left,top,right,bottom,offset,2*PI/60+offset);//绘制扇形
						setfillcolor(RGB(255,255,255));//白色
						solidpie(left,top,right,bottom,2*PI/60+offset,3*PI/60+offset);//绘制扇形
						setfillcolor(color2);//红色
						solidpie(left,top,right,bottom,3*PI/60+offset,5*PI/60+offset);//绘制扇形
						setfillcolor(RGB(0,0,0));//黑色
						solidpie(left,top,right,bottom,5*PI/60+offset,6*PI/60+offset);//绘制扇形
					}
					totaloffset += PI/20; 
				}
			}
		}
		_getch();//暂停
	}
	return 0;
}